/**
 * Created by joustany on 17/10/9.
 */
var random = Math.floor(Math.random()*10000)
$(document).ajaxError(function(event,xhr,options){
    "use strict"
    layer.open({
        content: '服务器异常，请联系客服'
        ,skin: 'msg'
        ,time: 2 //2秒后自动关闭
    });
})
var loding
$(document).ajaxStart(function(event,xhr,options){
    "use strict"
    loding = layer.open({type: 2});
})
$(document).ajaxComplete(function(event,xhr,options){
    "use strict"
    layer.close(loding)
})

var api = function(theInterface){
    var link = '';
    if (location.host.indexOf('t.m.antfre.com') > -1) {
        link = "http://t.api.antfre.com" + theInterface;
    }
    else if (location.host.indexOf('m.antfre.com') > -1){
        link = "https://api.antfre.com" + theInterface;
    }
    else {
        link = "http://t.api.antfre.com" + theInterface;
    }
    return link;
}
$(function(){
    pushHistory();
    var bool=false;
    setTimeout(function(){
        bool=true;
    },1500);
    window.addEventListener("popstate", function(e) {
        if(bool)
        {
            alert("禁止返回重新操作");//根据自己的需求实现自己的功能
        }
        pushHistory();

    }, false);
    function pushHistory() {
        var state = {
            title: "title",
            url: "#"
        };
        window.history.pushState(state, "title", "#");
    }
});
